const express = require('express');
const bodyParser = require('body-parser');
const authRoutes = require('./routes/user');
require('dotenv').config();
const cors = require('cors');

console.log(process.env.PORT);

const app = express();
const PORT = process.env.PORT || 3000;

app.use(cors());

app.use(bodyParser.json());
// 配置中间件  
// app.use(express.json()); // 用于解析JSON格式的请求体  

app.use('/api/auth', authRoutes);

app.listen(PORT, () => {
  console.log(`Server is running on port ${PORT}`);
});